<%--
  Created by IntelliJ IDEA.
  User: yaclt
  Date: 2021/12/3 0003
  Time: 15:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<sql:setDataSource var="a" driver="com.mysql.cj.jdbc.Driver"
                   url="jdbc:mysql://localhost/test"
                   user="root"  password="123456"/>

<sql:query dataSource="${a}" var="result">
  SELECT * from userinfo;
</sql:query>

<table border="1" width="100%">
  <tr>
    <th>id</th>
    <th>nickname</th>
    <th>account</th>
    <th>password</th>
  </tr>
  <c:forEach var="row" items="${result.rows}">
    <tr>
      <td><c:out value="${row.id}"/></td>
      <td><c:out value="${row.nickaname}"/></td>
      <td><c:out value="${row.account}"/></td>
      <td><c:out value="${row.password}"/></td>
    </tr>
  </c:forEach>
</table>
</body>
</html>
